Track failed playback commands with bounded retry backoff#259
Merged
Conversation
1a14385 to
c670ac5
Compare
Gudsfile
reviewed
May 20, 2026
Owner
Gudsfile
left a comment
There was a problem hiding this comment.
Two minor suggestions, otherwise looks good to me!
Gudsfile
approved these changes
May 20, 2026
Collaborator
Author
|
I agree, I was also a little uneasy about introducing this new text field without better validation. I went ahead and added the tag separately and simplified the conditional. I added some validation to constrain the legitimate tag cases for now, but I could see us expanding those in the future. |
Gudsfile
added a commit
that referenced
this pull request
May 21, 2026
## Summary Fixes #258 Depends on #259 This PR completes recovery for the stale Sonos host issue. In the reported failure, jukebox held onto a SoCo object for `Living Room` at `192.168.1.24` after the speaker moved to `192.168.1.25`. A later `pause()` attempted to contact the old host and failed with `No route to host`. This change adds Sonos adapter recovery for transport failures. When `play`, `pause`, `resume`, or `stop` fails because the current Sonos object is unreachable, the adapter re-resolves the saved playback target, switches to the newly resolved coordinator host, rebuilds the ShareLink plugin, and retries the command once. ## Changes - Add `SonosPlaybackTarget` and `SonosPlaybackTargetResolver` as the recovery boundary. - Teach `DefaultSonosService` to resolve a playback target back into a runtime Sonos group. - Wire the playback target resolver through `build_jukebox()`. - Cache the speaker name from `get_speaker_info()` so command logging does not trigger a networked `player_name` lookup. - Replace the old UPnP decorator with shared command execution that handles recovery while preserving known UPnP error logging. - Add coverage for stale-IP recovery, failed recovery, DI wiring, playback target resolution, and UPnP error handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the first PR in the Sonos stale-IP recovery stack (refs #258). The original issue was triggered when the selected Sonos speaker changed LAN IPs, leaving the running process with a stale SoCo connection. A later
pause()call then failed withNo route to host.This PR does not re-resolve stale Sonos speakers yet. Instead, it makes playback command failures safe in the domain state machine:
PlaybackCommandRetrytoPlaybackSessionplay,resume,pause, orstopsucceedspaused_atwhenpause()did not actually pause playbackBehavior
When a playback command raises
PlaybackError, the session now records retry metadata and leaves the logical playback state unchanged. Matching actions are retried after backoff; unrelated actions can clear or replace the retry state.This prevents failed commands from making the app believe Sonos changed state when it did not.
Notes
pause), then the jukebox state will be stuck until another event is initiated